
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _USUARIOS
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "USUARIOS"
			Me.MappingName = "USUARIOS"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
        '  	Public Function LoadAll() As Booleanean
        '=================================================================
        '  Loads all of the records in the database, and sets the currentRow to the first row
        '=================================================================
        Public Function LoadAll() As Boolean

            Dim parameters As ListDictionary = Nothing


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_USUARIOSLoadAll]", parameters)

        End Function

        '=================================================================
        ' Public Overridable Function LoadByPrimaryKey()  As Booleanean
        '=================================================================
        '  Loads a single row of via the primary key
        '=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal Codusuario As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_USUARIOS.Parameters.Codusuario, Codusuario)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_USUARIOSLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property Codusuario As SqlParameter
                Get
                    Return New SqlParameter("@Codusuario", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Usuario As SqlParameter
                Get
                    Return New SqlParameter("@Usuario", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property Pass As SqlParameter
                Get
                    Return New SqlParameter("@Pass", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property Nombre As SqlParameter
                Get
                    Return New SqlParameter("@Nombre", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property Apellido As SqlParameter
                Get
                    Return New SqlParameter("@Apellido", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property Ci As SqlParameter
                Get
                    Return New SqlParameter("@Ci", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property Area As SqlParameter
                Get
                    Return New SqlParameter("@Area", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Fechaalta As SqlParameter
                Get
                    Return New SqlParameter("@Fechaalta", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Fechabaja As SqlParameter
                Get
                    Return New SqlParameter("@Fechabaja", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Active As SqlParameter
                Get
                    Return New SqlParameter("@Active", SqlDbType.Bit, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const Codusuario As String = "codusuario"
            Public Const Usuario As String = "usuario"
            Public Const Pass As String = "pass"
            Public Const Nombre As String = "nombre"
            Public Const Apellido As String = "apellido"
            Public Const Ci As String = "ci"
            Public Const Area As String = "area"
            Public Const Fechaalta As String = "fechaalta"
            Public Const Fechabaja As String = "fechabaja"
            Public Const Active As String = "active"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(Codusuario) = _USUARIOS.PropertyNames.Codusuario
                    ht(Usuario) = _USUARIOS.PropertyNames.Usuario
                    ht(Pass) = _USUARIOS.PropertyNames.Pass
                    ht(Nombre) = _USUARIOS.PropertyNames.Nombre
                    ht(Apellido) = _USUARIOS.PropertyNames.Apellido
                    ht(Ci) = _USUARIOS.PropertyNames.Ci
                    ht(Area) = _USUARIOS.PropertyNames.Area
                    ht(Fechaalta) = _USUARIOS.PropertyNames.Fechaalta
                    ht(Fechabaja) = _USUARIOS.PropertyNames.Fechabaja
                    ht(Active) = _USUARIOS.PropertyNames.Active

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const Codusuario As String = "Codusuario"
            Public Const Usuario As String = "Usuario"
            Public Const Pass As String = "Pass"
            Public Const Nombre As String = "Nombre"
            Public Const Apellido As String = "Apellido"
            Public Const Ci As String = "Ci"
            Public Const Area As String = "Area"
            Public Const Fechaalta As String = "Fechaalta"
            Public Const Fechabaja As String = "Fechabaja"
            Public Const Active As String = "Active"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(Codusuario) = _USUARIOS.ColumnNames.Codusuario
                    ht(Usuario) = _USUARIOS.ColumnNames.Usuario
                    ht(Pass) = _USUARIOS.ColumnNames.Pass
                    ht(Nombre) = _USUARIOS.ColumnNames.Nombre
                    ht(Apellido) = _USUARIOS.ColumnNames.Apellido
                    ht(Ci) = _USUARIOS.ColumnNames.Ci
                    ht(Area) = _USUARIOS.ColumnNames.Area
                    ht(Fechaalta) = _USUARIOS.ColumnNames.Fechaalta
                    ht(Fechabaja) = _USUARIOS.ColumnNames.Fechabaja
                    ht(Active) = _USUARIOS.ColumnNames.Active

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const Codusuario As String = "s_Codusuario"
            Public Const Usuario As String = "s_Usuario"
            Public Const Pass As String = "s_Pass"
            Public Const Nombre As String = "s_Nombre"
            Public Const Apellido As String = "s_Apellido"
            Public Const Ci As String = "s_Ci"
            Public Const Area As String = "s_Area"
            Public Const Fechaalta As String = "s_Fechaalta"
            Public Const Fechabaja As String = "s_Fechabaja"
            Public Const Active As String = "s_Active"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property Codusuario As Integer
            Get
                Return MyBase.Getint(ColumnNames.Codusuario)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.Codusuario, Value)
            End Set
        End Property

        Public Overridable Property Usuario As String
            Get
                Return MyBase.Getstring(ColumnNames.Usuario)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Usuario, Value)
            End Set
        End Property

        Public Overridable Property Pass As String
            Get
                Return MyBase.Getstring(ColumnNames.Pass)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Pass, Value)
            End Set
        End Property

        Public Overridable Property Nombre As String
            Get
                Return MyBase.Getstring(ColumnNames.Nombre)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Nombre, Value)
            End Set
        End Property

        Public Overridable Property Apellido As String
            Get
                Return MyBase.Getstring(ColumnNames.Apellido)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Apellido, Value)
            End Set
        End Property

        Public Overridable Property Ci As String
            Get
                Return MyBase.Getstring(ColumnNames.Ci)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Ci, Value)
            End Set
        End Property

        Public Overridable Property Area As Integer
            Get
                Return MyBase.Getint(ColumnNames.Area)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.Area, Value)
            End Set
        End Property

        Public Overridable Property Fechaalta As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Fechaalta)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Fechaalta, Value)
            End Set
        End Property

        Public Overridable Property Fechabaja As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Fechabaja)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Fechabaja, Value)
            End Set
        End Property

        Public Overridable Property Active As Boolean
            Get
                Return MyBase.Getbool(ColumnNames.Active)
            End Get
            Set(ByVal Value As Boolean)
                MyBase.Setbool(ColumnNames.Active, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_Codusuario As String
			Get
				If Me.IsColumnNull(ColumnNames.Codusuario) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.Codusuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Codusuario)
				Else
					Me.Codusuario = MyBase.SetintAsString(ColumnNames.Codusuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Usuario As String
			Get
				If Me.IsColumnNull(ColumnNames.Usuario) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Usuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Usuario)
				Else
					Me.Usuario = MyBase.SetstringAsString(ColumnNames.Usuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Pass As String
			Get
				If Me.IsColumnNull(ColumnNames.Pass) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Pass)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Pass)
				Else
					Me.Pass = MyBase.SetstringAsString(ColumnNames.Pass, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Nombre As String
			Get
				If Me.IsColumnNull(ColumnNames.Nombre) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Nombre)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Nombre)
				Else
					Me.Nombre = MyBase.SetstringAsString(ColumnNames.Nombre, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Apellido As String
			Get
				If Me.IsColumnNull(ColumnNames.Apellido) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Apellido)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Apellido)
				Else
					Me.Apellido = MyBase.SetstringAsString(ColumnNames.Apellido, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Ci As String
			Get
				If Me.IsColumnNull(ColumnNames.Ci) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Ci)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Ci)
				Else
					Me.Ci = MyBase.SetstringAsString(ColumnNames.Ci, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Area As String
			Get
				If Me.IsColumnNull(ColumnNames.Area) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.Area)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Area)
				Else
					Me.Area = MyBase.SetintAsString(ColumnNames.Area, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fechaalta As String
			Get
				If Me.IsColumnNull(ColumnNames.Fechaalta) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fechaalta)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fechaalta)
				Else
					Me.Fechaalta = MyBase.SetDateTimeAsString(ColumnNames.Fechaalta, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fechabaja As String
			Get
				If Me.IsColumnNull(ColumnNames.Fechabaja) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fechabaja)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fechabaja)
				Else
					Me.Fechabaja = MyBase.SetDateTimeAsString(ColumnNames.Fechabaja, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Active As String
			Get
				If Me.IsColumnNull(ColumnNames.Active) Then
					Return String.Empty
				Else
					Return MyBase.GetboolAsString(ColumnNames.Active)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Active)
				Else
					Me.Active = MyBase.SetboolAsString(ColumnNames.Active, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property Codusuario() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.Codusuario, Parameters.Codusuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Usuario() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Usuario, Parameters.Usuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Pass() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Pass, Parameters.Pass)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Nombre() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Nombre, Parameters.Nombre)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Apellido() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Apellido, Parameters.Apellido)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Ci() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Ci, Parameters.Ci)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Area() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Area, Parameters.Area)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Fechaalta() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Fechaalta, Parameters.Fechaalta)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Fechabaja() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Fechabaja, Parameters.Fechabaja)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Active() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Active, Parameters.Active)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property Codusuario() As WhereParameter 
			Get
				If _Codusuario_W Is Nothing Then
					_Codusuario_W = TearOff.Codusuario
				End If
				Return _Codusuario_W
			End Get
		End Property

		Public ReadOnly Property Usuario() As WhereParameter 
			Get
				If _Usuario_W Is Nothing Then
					_Usuario_W = TearOff.Usuario
				End If
				Return _Usuario_W
			End Get
		End Property

		Public ReadOnly Property Pass() As WhereParameter 
			Get
				If _Pass_W Is Nothing Then
					_Pass_W = TearOff.Pass
				End If
				Return _Pass_W
			End Get
		End Property

		Public ReadOnly Property Nombre() As WhereParameter 
			Get
				If _Nombre_W Is Nothing Then
					_Nombre_W = TearOff.Nombre
				End If
				Return _Nombre_W
			End Get
		End Property

		Public ReadOnly Property Apellido() As WhereParameter 
			Get
				If _Apellido_W Is Nothing Then
					_Apellido_W = TearOff.Apellido
				End If
				Return _Apellido_W
			End Get
		End Property

		Public ReadOnly Property Ci() As WhereParameter 
			Get
				If _Ci_W Is Nothing Then
					_Ci_W = TearOff.Ci
				End If
				Return _Ci_W
			End Get
		End Property

		Public ReadOnly Property Area() As WhereParameter 
			Get
				If _Area_W Is Nothing Then
					_Area_W = TearOff.Area
				End If
				Return _Area_W
			End Get
		End Property

		Public ReadOnly Property Fechaalta() As WhereParameter 
			Get
				If _Fechaalta_W Is Nothing Then
					_Fechaalta_W = TearOff.Fechaalta
				End If
				Return _Fechaalta_W
			End Get
		End Property

		Public ReadOnly Property Fechabaja() As WhereParameter 
			Get
				If _Fechabaja_W Is Nothing Then
					_Fechabaja_W = TearOff.Fechabaja
				End If
				Return _Fechabaja_W
			End Get
		End Property

		Public ReadOnly Property Active() As WhereParameter 
			Get
				If _Active_W Is Nothing Then
					_Active_W = TearOff.Active
				End If
				Return _Active_W
			End Get
		End Property

		Private _Codusuario_W As WhereParameter = Nothing
		Private _Usuario_W As WhereParameter = Nothing
		Private _Pass_W As WhereParameter = Nothing
		Private _Nombre_W As WhereParameter = Nothing
		Private _Apellido_W As WhereParameter = Nothing
		Private _Ci_W As WhereParameter = Nothing
		Private _Area_W As WhereParameter = Nothing
		Private _Fechaalta_W As WhereParameter = Nothing
		Private _Fechabaja_W As WhereParameter = Nothing
		Private _Active_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_Codusuario_W = Nothing
			_Usuario_W = Nothing
			_Pass_W = Nothing
			_Nombre_W = Nothing
			_Apellido_W = Nothing
			_Ci_W = Nothing
			_Area_W = Nothing
			_Fechaalta_W = Nothing
			_Fechabaja_W = Nothing
			_Active_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property Codusuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Codusuario, Parameters.Codusuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Usuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Usuario, Parameters.Usuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Pass() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Pass, Parameters.Pass)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Nombre() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Nombre, Parameters.Nombre)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Apellido() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Apellido, Parameters.Apellido)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Ci() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Ci, Parameters.Ci)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Area() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Area, Parameters.Area)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fechaalta() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fechaalta, Parameters.Fechaalta)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fechabaja() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fechabaja, Parameters.Fechabaja)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Active() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Active, Parameters.Active)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property Codusuario() As AggregateParameter 
			Get
				If _Codusuario_W Is Nothing Then
					_Codusuario_W = TearOff.Codusuario
				End If
				Return _Codusuario_W
			End Get
		End Property

		Public ReadOnly Property Usuario() As AggregateParameter 
			Get
				If _Usuario_W Is Nothing Then
					_Usuario_W = TearOff.Usuario
				End If
				Return _Usuario_W
			End Get
		End Property

		Public ReadOnly Property Pass() As AggregateParameter 
			Get
				If _Pass_W Is Nothing Then
					_Pass_W = TearOff.Pass
				End If
				Return _Pass_W
			End Get
		End Property

		Public ReadOnly Property Nombre() As AggregateParameter 
			Get
				If _Nombre_W Is Nothing Then
					_Nombre_W = TearOff.Nombre
				End If
				Return _Nombre_W
			End Get
		End Property

		Public ReadOnly Property Apellido() As AggregateParameter 
			Get
				If _Apellido_W Is Nothing Then
					_Apellido_W = TearOff.Apellido
				End If
				Return _Apellido_W
			End Get
		End Property

		Public ReadOnly Property Ci() As AggregateParameter 
			Get
				If _Ci_W Is Nothing Then
					_Ci_W = TearOff.Ci
				End If
				Return _Ci_W
			End Get
		End Property

		Public ReadOnly Property Area() As AggregateParameter 
			Get
				If _Area_W Is Nothing Then
					_Area_W = TearOff.Area
				End If
				Return _Area_W
			End Get
		End Property

		Public ReadOnly Property Fechaalta() As AggregateParameter 
			Get
				If _Fechaalta_W Is Nothing Then
					_Fechaalta_W = TearOff.Fechaalta
				End If
				Return _Fechaalta_W
			End Get
		End Property

		Public ReadOnly Property Fechabaja() As AggregateParameter 
			Get
				If _Fechabaja_W Is Nothing Then
					_Fechabaja_W = TearOff.Fechabaja
				End If
				Return _Fechabaja_W
			End Get
		End Property

		Public ReadOnly Property Active() As AggregateParameter 
			Get
				If _Active_W Is Nothing Then
					_Active_W = TearOff.Active
				End If
				Return _Active_W
			End Get
		End Property

		Private _Codusuario_W As AggregateParameter = Nothing
		Private _Usuario_W As AggregateParameter = Nothing
		Private _Pass_W As AggregateParameter = Nothing
		Private _Nombre_W As AggregateParameter = Nothing
		Private _Apellido_W As AggregateParameter = Nothing
		Private _Ci_W As AggregateParameter = Nothing
		Private _Area_W As AggregateParameter = Nothing
		Private _Fechaalta_W As AggregateParameter = Nothing
		Private _Fechabaja_W As AggregateParameter = Nothing
		Private _Active_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_Codusuario_W = Nothing
		_Usuario_W = Nothing
		_Pass_W = Nothing
		_Nombre_W = Nothing
		_Apellido_W = Nothing
		_Ci_W = Nothing
		_Area_W = Nothing
		_Fechaalta_W = Nothing
		_Fechabaja_W = Nothing
		_Active_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_USUARIOSInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.Codusuario.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_USUARIOSUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_USUARIOSDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.Codusuario)
		p.SourceColumn = ColumnNames.Codusuario
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.Codusuario)
		p.SourceColumn = ColumnNames.Codusuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Usuario)
		p.SourceColumn = ColumnNames.Usuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Pass)
		p.SourceColumn = ColumnNames.Pass
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Nombre)
		p.SourceColumn = ColumnNames.Nombre
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Apellido)
		p.SourceColumn = ColumnNames.Apellido
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Ci)
		p.SourceColumn = ColumnNames.Ci
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Area)
		p.SourceColumn = ColumnNames.Area
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fechaalta)
		p.SourceColumn = ColumnNames.Fechaalta
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fechabaja)
		p.SourceColumn = ColumnNames.Fechabaja
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Active)
		p.SourceColumn = ColumnNames.Active
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

